import defaultSettings from './default_settings.js'
import {
  reservedSettingsLoadBefore,
  reservedSettingsLoadBeforeMount,
  reservedSettingsLoadAfter
} from './modules/settings_loader_reserved.js'
import {
  customSettingsLoadBefore,
  customSettingsLoadBeforeMount,
  customSettingsLoadAfter
} from './modules/settings_loader_custom.js'

// 经过计算的参数值
const ComputedSettings = defaultSettings

async function loadBefore() {
  await reservedSettingsLoadBefore(ComputedSettings)
  await customSettingsLoadBefore(ComputedSettings)
}

async function loadBeforeMount(appInstance) {
  await reservedSettingsLoadBeforeMount(ComputedSettings, appInstance)
  await customSettingsLoadBeforeMount(ComputedSettings, appInstance)
}

async function loadAfter(appInstance) {
  await reservedSettingsLoadAfter(ComputedSettings, appInstance)
  await customSettingsLoadAfter(ComputedSettings, appInstance)
}

// ASC（App Settings Core）对象
export default {
  loadBefore,
  loadBeforeMount,
  loadAfter,
  settings: ComputedSettings
}
